home *** CD-ROM | disk | FTP | other *** search
- property pSpr, pLastLine, pColorizedVersion, pRawIngredients, pRecipe
-
- on beginSprite me
- pSpr = sprite(me.spriteNum)
- mRefresh(me)
- end
-
- on mRefresh me
- pLastLine = 0
- pRecipe = sprite(me.spriteNum - 1)
- if isText(pSpr) then
- pRawIngredients = getRecipeIngredientsByName(pRecipe.member.text)
- else
- exit
- end if
- pSpr.member.RTF = pSpr.member.RTF
- mSetNewColorizedText(me)
- end
-
- on mSetNewColorizedText me
- pSpr = sprite(me.spriteNum)
- pColorizedVersion = pSpr.member.RTF
- end
-
- on mouseLeave me
- pLastLine = 0
- refreshOldColorizedText(me)
- tell the stage
- hideToolTip()
- end tell
- end
-
- on refreshOldColorizedText me
- if (pSpr.member.boxType = #scroll) and (pSpr.member.scrollTop <> 0) then
- lastScroll = pSpr.member.scrollTop
- pSpr.member.RTF = pColorizedVersion
- pSpr.member.scrollTop = lastScroll - 1
- pSpr.member.scrollTop = lastScroll
- else
- pSpr.member.RTF = pColorizedVersion
- end if
- end
-
- on mouseWithin me
- if paused() then
- exit
- end if
- reply = helpUserWithThisIngredient(pSpr, pRawIngredients)
- X = reply[1]
- ingredient = reply[2]
- if (pLastLine <> X) and not voidp(ingredient) then
- if the activeWindow <> the stage then
- tell the stage
- rollSprite = grabThisIngredient(ingredient, 1)
- if rollSprite > 0 then
- rollSprite = sprite(rollSprite)
- forceToolTip(rollSprite, ingredient, point(rollSprite.left, rollSprite.top + (rollSprite.height / 3)))
- end if
- end tell
- end if
- pLastLine = X
- refreshOldColorizedText(me)
- if X > 0 then
- pSpr.member.line[X].color = red()
- end if
- else
- if (X = 0) and (pLastLine <> 0) then
- pLastLine = 0
- refreshOldColorizedText(me)
- tell the stage
- hideToolTip()
- end tell
- end if
- end if
- end
-
- on mouseDown
- if paused() then
- exit
- end if
- reply = helpUserWithThisIngredient(pSpr, pRawIngredients)
- X = reply[1]
- ingredient = reply[2]
- if not voidp(ingredient) then
- if the activeWindow <> the stage then
- tell the stage
- grabThisIngredient(ingredient)
- end tell
- end if
- end if
- end
-